local shichou = fk.CreateSkill{
  name = "mini__shichou",
}

Fk:loadTranslationTable{
  ["mini__shichou"] = "誓仇",
  [":mini__shichou"] = "你使用【杀】可以额外指定至多X名角色为目标（X为你已损失的体力值）。当你使用【杀】结算结束后，若未造成伤害，你获得之。",

  ["#mini__shichou-choose"] = "誓仇：你可以为此%arg额外指定至多%arg2个目标",

  ["$mini__shichou1"] = "誓要让手中银枪饱饮鲜血！",
  ["$mini__shichou2"] = "此仇不报，还有何面目立于世间！",
}

shichou:addEffect(fk.AfterCardTargetDeclared, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(shichou.name) and data.card.trueName == "slash" and
      player:isWounded() and #data:getExtraTargets() > 0
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local tos = room:askToChoosePlayers(player, {
      min_num = 1,
      max_num = player:getLostHp(),
      targets = data:getExtraTargets(),
      skill_name = shichou.name,
      prompt = "#mini__shichou-choose:::"..data.card:toLogString()..":"..player:getLostHp(),
      cancelable = true,
    })
    if #tos > 0 then
      room:sortByAction(tos)
      event:setCostData(self, {tos = tos})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    for _, p in ipairs(event:getCostData(self).tos) do
      data:addTarget(p)
    end
  end,
})

shichou:addEffect(fk.CardUseFinished, {
  anim_type = "drawcard",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(shichou.name) and
      data.card.trueName == "slash" and not data.damageDealt and
      player.room:getCardArea(data.card) == Card.Processing
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    player.room:moveCardTo(data.card, Card.PlayerHand, player, fk.ReasonJustMove, shichou.name, nil, true, player)
  end,
})

return shichou
